package com.AI.AIDemo.Demos.Web.Config;

import com.AI.AIDemo.Demos.Web.Entity.AIEnity;
import lombok.Setter;
import org.dromara.easyai.nerveCenter.NerveManager;
import org.dromara.easyai.nerveEntity.SensoryNerve;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * {@code @Author:大力王}
 * {@code @Date:2025/4/27-27-14:30}
 * 神经网络管理器是构建神经网络的总控开关，它负责配置参数与创建网络结构的主类v
 * 开始了
 */
@Setter
@Configuration
public class AIConfig {
    private int id;
    private int upNub;
    private int channelNo;

    @Bean
    public NerveManager getNerveManager() throws Exception {
        AIEnity aiEnity = new AIEnity();
        aiEnity.setSensoryNerveNub(3);
        aiEnity.setHiddenNerveNub(2);
        aiEnity.setOutNerveNub(1);
        aiEnity.setHiddenDepth(3);
        aiEnity.setActiveFunction(new com.AI.AIDemo.Demos.Web.Service.ServiceImpl.AIDemoServerImpl().getTransFormer());
        aiEnity.setStudyPoint(0.01f);
        aiEnity.setRzType(0);
        aiEnity.setLParam(0);
        aiEnity.setCoreNumber(1);
        aiEnity.setAuTo(false);
        aiEnity.setGama(0.9f);
        aiEnity.setGMaxTh(0.01f);
        return new NerveManager(aiEnity.getSensoryNerveNub(), aiEnity.getHiddenNerveNub(), aiEnity.getOutNerveNub(), aiEnity.getHiddenDepth(), aiEnity.getActiveFunction(), aiEnity.getStudyPoint(), aiEnity.getRzType(), aiEnity.getLParam(), aiEnity.getCoreNumber(), aiEnity.getGama(), aiEnity.getGMaxTh(), aiEnity.isAuTo());
    }

    @Bean
    public SensoryNerve getSensoryNerve() throws Exception {
        id = 1;
        upNub = 3;
        channelNo = 3;
        return new SensoryNerve( id, upNub, channelNo);
    }
}
